//
//  TopView.m
//  类似淘宝详情页
//
//  Created by songhuipan on 16/6/26.
//  Copyright © 2016年 songhuipan. All rights reserved.
//

#import "TopView.h"


@interface TopView ()
@property (nonatomic,assign)NSInteger index;
@end
@implementation TopView
- (void)addSubview:(UIView *)view {
    [super addSubview:view];
    view.tag = self.index;
    self.index ++;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.bounds.size.width/self.index;
    CGFloat height = self.bounds.size.height;
    for (UIView *subView in self.subviews) {
        subView.frame = CGRectMake(subView.tag*width, 0, width, height);
    }
}
@end
